package com.djf.eg.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.djf.eg.dao.SysPermissionDao;
import com.djf.eg.entity.SysPermission;
import com.djf.eg.util.convert.Entity2Vo;
import com.djf.eg.vo.MenuVo;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

@Service
public class PermissionService {
	@Autowired
	SysPermissionDao permissionDao;
	
//	public Page<SysPermission> getPermissions(Pageable pageable) {
//		return permissionRepository.findAll(pageable);
//	}
	
	public List<MenuVo> getAllPermissions() {
		List<SysPermission> permissionList = permissionDao.getPermissions();
		return Entity2Vo.permissionList2MenuVoList(permissionList);
	}
	
	public Page<SysPermission> getPermissions(int pageNum, int pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		return permissionDao.getPermissionsByPage();
	}
}
